package com.huawei.appmarket.framework.widget.downloadbutton;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appgallery.foundation.ui.framework.widget.button.ButtonFactory;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import java.util.Iterator;
import o.djw;
import o.Logger;
import o.dvt;

public class ButtonInitImpl$1 extends Handler {
    public ButtonInitImpl$1(Looper looper) {
        super(looper);
    }

    public void handleMessage(Message message) {
        Iterator it = ButtonFactory.ˊ().iterator();
        while (it.hasNext()) {
            DownloadButton downloadButton = (DownloadButton) it.next();
            if (TextUtils.isEmpty(downloadButton.ॱॱ())) {
                Logger.ˎ(djw.ˎ, "REFRESH_PROGRESS_RUNNABLE, package is empty, remove it");
                it.remove();
            } else {
                SessionDownloadTask ˋ = dvt.ˏ().ˋ(downloadButton.ॱॱ());
                if (ˋ == null) {
                    Logger.ˎ(djw.ˎ, "REFRESH_PROGRESS_RUNNABLE, task is null, remove it");
                    it.remove();
                } else {
                    downloadButton.setDownloadProgress(ˋ.ʼॱ());
                }
            }
        }
    }
}
